﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentData;
using Huazhu.PMS.Framework.Data;

namespace Huazhu.PMS.Framework.Core
{
    internal class RoleDataAccess : BaseDataAccess
    {
        internal List<RoleInfo> GetRoles()
        {
            var sql = "SELECT [dbo].[Role_Info].[sRoleID] FROM [dbo].[Role_Info]";

            using (var context = DataHelper.GetBaseDbContext())
            {
                var roles =
                    context.Sql(sql).QueryMany<RoleInfo>(delegate(RoleInfo map, IDataReader reader)
                    {
                        map.RoleID = reader.GetString("sRoleID");
                        //TODO:更多字段
                    });
                return roles;
            }
        }
    }
}
